home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / C-D / DeveloperStax.cpt / Developer Stack 1.0 / card_13324.txt < prev    next >
Text File  |  1989-02-26  |  5KB  |  158 lines

  1. -- card: 13324 from stack: in.0
  2. -- bmap block id: 0
  3. -- flags: 4000
  4. -- background id: 13187
  5. -- name: Scroll Text Button 1
  6.  
  7.  
  8. -- part 6 (field)
  9. -- low flags: 01
  10. -- high flags: 0000
  11. -- rect: left=68 top=308 right=325 bottom=212
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 0
  15. -- font id: 3
  16. -- text size: 12
  17. -- style flags: 0
  18. -- line height: 16
  19. -- part name: Result
  20.  
  21.  
  22. -- part 7 (field)
  23. -- low flags: 00
  24. -- high flags: 4007
  25. -- rect: left=57 top=70 right=299 bottom=491
  26. -- title width / last selected line: 0
  27. -- icon id / first selected line: 0 / 0
  28. -- text alignment: 0
  29. -- font id: 3
  30. -- text size: 9
  31. -- style flags: 0
  32. -- line height: 12
  33. -- part name: 
  34. ----- HyperTalk script -----
  35. --
  36. -- Field script to allow special handling of option-clicked
  37. -- words in ANY text field, whether locked or unlocked
  38. --
  39. -- Guy Kuo, University of Nevada School of Medicine
  40. -- December 13, 1987
  41. --
  42. -- Use this script freely in your owns stacks but please retain the
  43. -- credit line
  44. --
  45. On MouseWithin -- UNSOM technique by Guy Kuo, December 13, 1987
  46.   -- If the the option key is depressed, set the cursor to indicate
  47.   -- we are in a special mode.  While the option key continues to be
  48.   -- depressed, and the mouse is within the target field, wait for
  49.   -- mouseDowns.  If one occurs, Pick up the word by clicking at the
  50.   -- last MouseLoc twice and getting the selection.
  51.   -- If the selection is not empty, do something with it.  In this demo,
  52.   -- we put it into another field.  Finally, click outside of the field
  53.   -- to avoid looping.  Hopefully, (-1,-1) is outside of all active
  54.   -- objects.
  55.   --
  56.   -- While editing such a field, entry of Optioned characters from
  57.   -- the keyboard no longer requires movement of the mouse outside of
  58.   -- the field.  However, the optioned characters do not appear until
  59.   -- after the option key is released
  60.  
  61.   if the OptionKey is down then
  62.     if the locktext of the target is true then
  63.       put true into DidUnlock
  64.       set locktext of target to false
  65.     else
  66.       put false into DidUnlock
  67.     end if
  68.     set the cursor to 2
  69.     repeat while (the OptionKey is down) and (item 1 of the rect of target <= item 1 of the mouseLoc) and (item 1 of the mouseLoc <= item 3 of the rect of target) and (item 2 of the rect of target <= item 2 of the mouseLoc) and (item 2 of the mouseLoc <= item 4 of the rect of target)
  70.       if the Mouse is down then
  71.         click at the MouseLoc
  72.         click at the ClickLoc
  73.         if the selection <> empty then
  74.           put the selection into card field "result"
  75.           -- or do something useful with it
  76.         end if
  77.         click at -1,-1
  78.       end if
  79.     end repeat
  80.     if DidUnlock then
  81.       set the locktext of the target to true
  82.     end if
  83.   end if
  84. end MouseWithin
  85.  
  86.  
  87.  
  88. -- part contents for background part 4
  89. ----- text -----
  90. 1
  91.  
  92. -- part contents for background part 2
  93. ----- text -----
  94. Scrolling Text Button 1
  95.  
  96. -- part contents for card part 6
  97. ----- text -----
  98. mouseLoc
  99.  
  100. -- part contents for card part 7
  101. ----- text -----
  102. OPTION CLICK on any word in this field for an example of how this script works.
  103. --
  104. -- Field script to allow special handling of option-clicked
  105. -- words in ANY text field, whether locked or unlocked
  106. --
  107. -- Guy Kuo, University of Nevada School of Medicine
  108. -- December 13, 1987
  109. --
  110. -- Use this script freely in your owns stacks but please retain the
  111. -- credit line
  112. --
  113. On MouseWithin -- UNSOM technique by Guy Kuo, December 13, 1987
  114.   -- If the the option key is depressed, set the cursor to indicate
  115.   -- we are in a special mode.  While the option key continues to be
  116.   -- depressed, and the mouse is within the target field, wait for
  117.   -- mouseDowns.  If one occurs, Pick up the word by clicking at the
  118.   -- last MouseLoc twice and getting the selection.
  119.   -- If the selection is not empty, do something with it.  In this demo,
  120.   -- we put it into another field.  Finally, click outside of the field
  121.   -- to avoid looping.  Hopefully, (-1,-1) is outside of all active
  122.   -- objects.
  123.   --
  124.   -- While editing such a field, entry of Optioned characters from
  125.   -- the keyboard no longer requires movement of the mouse outside of
  126.   -- the field.  However, the optioned characters do not appear until
  127.   -- after the option key is released
  128.   
  129.   if the OptionKey is down then
  130.     if the locktext of the target is true then
  131.       put true into DidUnlock
  132.       set locktext of target to false
  133.     else
  134.       put false into DidUnlock
  135.     end if
  136.     set the cursor to 2
  137.     repeat while (the OptionKey is down) and¬¨
  138.       (item 1 of the rect of target <= item 1 of the mouseLoc) and¬¨
  139.       (item 1 of the mouseLoc <= item 3 of the rect of target) and¬¨
  140.       (item 2 of the rect of target <= item 2 of the mouseLoc) and¬¨
  141.       (item 2 of the mouseLoc <= item 4 of the rect of target)
  142.       if the Mouse is down then
  143.         click at the MouseLoc
  144.         click at the ClickLoc
  145.         if the selection <> empty then
  146.           --
  147.           --the selected word is now in 'selection'.  It's up to you to do something with it. 
  148.           --
  149.         end if
  150.         click at -1,-1
  151.       end if
  152.     end repeat
  153.     if DidUnlock then
  154.       set the locktext of the target to true
  155.     end if
  156.   end if
  157. end MouseWithin
  158.